FROM centos

# MAINTAINER
MAINTAINER ystlong@163.com

# put nginx-1.12.2.tar.gz into /usr/local/src and unpack nginx
# ADD nginx-1.12.2.tar.gz /usr/local/src

# running required command

RUN yum install -y centos-release-openstack-queens
RUN yum install -y openstack-keystone httpd mod_wsgi

# vi /etc/keystone/keystone.conf
RUN sed -i 's|# *connection.*|connection = mysql+pymysql://root:123456@172.17.0.3/keystone|g' /etc/keystone/keystone.conf
RUN sed -i 's|# provider = fernet|provider = fernet|g' /etc/keystone/keystone.conf

RUN su -s /bin/sh -c "keystone-manage db_sync" keystone
RUN keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
RUN keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
RUN keystone-manage bootstrap --bootstrap-password 123456   --bootstrap-admin-url http://controller:5000/v3/   --bootstrap-internal-url http://controller:5000/v3/   --bootstrap-public-url http://controller:5000/v3/   --bootstrap-region-id RegionOne

# vi /etc/httpd/conf/httpd.conf 
RUN ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
RUN systemctl enable httpd.service
RUN systemctl start httpd.service

EXPOSE 80

====
FROM centos

# MAINTAINER
MAINTAINER ystlong@163.com

# put nginx-1.12.2.tar.gz into /usr/local/src and unpack nginx
# ADD nginx-1.12.2.tar.gz /usr/local/src

# running required command

# docker run -d --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name ctl centos /usr/sbin/init

find /etc/yum.repos.d -type f -exec sed -i 's|mirrorlist|#mirrorlist|g' {} \;
find /etc/yum.repos.d -type f -exec sed -i 's|mirror.centos.org|mirrors.ustc.edu.cn|g' {} \;
find /etc/yum.repos.d -type f -exec sed -i 's|#baseurl|baseurl|g' {} \;

yum install -y net-tools
yum install -y httpd
yum install -y centos-release-openstack-queens

find /etc/yum.repos.d -type f -exec sed -i 's|mirrorlist|#mirrorlist|g' {} \;
find /etc/yum.repos.d -type f -exec sed -i 's|mirror.centos.org|mirrors.ustc.edu.cn|g' {} \;
find /etc/yum.repos.d -type f -exec sed -i 's|#baseurl|baseurl|g' {} \;

yum install -y python-openstackclient
yum install -y openstack-keystone  mod_wsgi



# vi /etc/keystone/keystone.conf
sed -i 's|# *connection.*|connection = mysql+pymysql://root:123456@172.17.0.3/keystone|g' /etc/keystone/keystone.conf
sed -i 's|# provider = fernet|provider = fernet|g' /etc/keystone/keystone.conf

su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
keystone-manage bootstrap --bootstrap-password 123456   --bootstrap-admin-url http://controller:5000/v3/   --bootstrap-internal-url http://controller:5000/v3/   --bootstrap-public-url http://controller:5000/v3/   --bootstrap-region-id RegionOne

sed -i '/#ServerName/aServerName 172.17.0.2:80' /etc/httpd/conf/httpd.conf 
# vi /etc/httpd/conf/httpd.conf 
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
# systemctl enable httpd.service
# systemctl start httpd.service
httpd -k start



------
export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://172.17.0.2:35357/v3
export OS_IDENTITY_API_VERSION=3

openstack domain create --description "An Example Domain" example
